#include "stdafx.h"

#include "RegistryAccess.h"

CComBSTR GetRegistryKeyValue(CComBSTR regKey, CComBSTR valueName)
		{
		CRegKey key;
		CComBSTR value="";
    long nError = key.Open(HKEY_CURRENT_USER, regKey.m_str, KEY_READ);
    if(nError == ERROR_SUCCESS)
    {
			DWORD dwBufferSize = MAX_PATH;
			LPTSTR v = new TCHAR[MAX_PATH];
			key.QueryStringValue(valueName.m_str, v, &dwBufferSize );
			value.Append(v,dwBufferSize);
		}
		return value;
}